package com.azzcs.session;

import com.azzcs.parse.Configuration;
import com.azzcs.parse.XMLConfigurationBuilder;

import java.io.InputStream;

/**
 * @Author: wzg
 * @Date: 2020/12/6 上午10:50
 */
public class SqlSessionFactoryBuilder {

    private Configuration configuration;

    public SqlSessionFactoryBuilder() {
        this.configuration = new Configuration();
    }
    public SqlSessionFactory build(InputStream input) throws Exception {
        XMLConfigurationBuilder xmlConfigurationBuilder = new XMLConfigurationBuilder(configuration);
        xmlConfigurationBuilder.parseConfiguration(input);
        return new DefaultSqlSessionFactory(configuration);
    }
}
